package com.interest.controller.builder;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by yangfeng on 16-11-23.
 */
public class DefaultModelAndViewBuilder<T> extends ModelAndViewBuilder {
    private static final String MAP_KEY = "result";

    private final String viewName;
    private final T mapValue;

    public DefaultModelAndViewBuilder(String viewName, T mapValue) {
        this.viewName = viewName;
        this.mapValue = mapValue;
    }

    @Override
    protected Map<String, ?> getDataMap() {
        Map<String, Object> map = new HashMap<>();
        map.put(MAP_KEY, mapValue);
        return map;
    }

    @Override
    protected String getViewName() {
        return viewName;
    }
}
